//
//  WmcTeamMemberDetailEditItemView.swift
//  YPWatermarkCamera
//
//  Created by yupao_ios_macmini06 on 2022/9/14.
//

import UIKit

class WmcTeamMemberDetailEditItemView: WmcBaseView {
    override func makeUI() {
        addSubview(avatarView)
        addSubview(nameView)
        addSubview(editBtn)

        avatarView.snp.makeConstraints { make in
            make.top.equalTo(14)
            make.left.equalTo(16)
            make.bottom.equalTo(-14)
            make.width.height.equalTo(44)
        }

        editBtn.snp.makeConstraints { make in
            make.right.equalTo(-16)
            make.centerY.equalToSuperview()
            make.width.greaterThanOrEqualTo(40)
        }

        nameView.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalTo(avatarView.snp.right).offset(12)
            make.right.lessThanOrEqualTo(editBtn.snp.left).offset(-8)
        }
    }

    func configure(model: WmcTeamMemberModel) {
        let member = WmcTeamMember(name: model.showName, img: model.avatar)
        avatarView.member = member
        nameView.configure(member: model)
    }

    lazy var avatarView: WmcMemberAvatarView = {
        let view = WmcMemberAvatarView()
        return view
    }()

    lazy var nameView: WmcTeamMemberNameView = {
        let view = WmcTeamMemberNameView()
        return view
    }()

    lazy var editBtn: WmcLeftImgRightTextBtn = {
        let btn = WmcLeftImgRightTextBtn(title: "编辑资料", image: "team_info_eidt_icon".wmc_image)
        btn.font = 14.wmc_font
        btn.imgSize = 18.wmc_autoHor
        btn.imgTextSpacing = 4
        btn.textColor = UIColor.wmc_blue_5290FD
        return btn
    }()
}
